

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>example_envs.tag_continuous package &mdash; WarpDrive 1.0 documentation</title>
  

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="https://assets.readthedocs.org/static/css/badge_only.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script async="async" src="https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="example_envs.tag_gridworld package" href="example_envs.tag_gridworld.html" />
    <link rel="prev" title="example_envs package" href="example_envs.html" /> 

<!-- RTD Extra Head -->

<link rel="stylesheet" href="https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css" type="text/css" />

<script type="application/json" id="READTHEDOCS_DATA">{"ad_free": "", "api_host": "", "build_date": "2021-08-31T22:53:13Z", "builder": "sphinx", "canonical_url": "", "commit": "", "docroot": "", "features": {"docsearch_disabled": false}, "global_analytics_code": null, "language": "", "page": "example_envs.tag_continuous", "programming_language": "", "project": "", "source_suffix": ".rst", "subprojects": {}, "theme": "", "user_analytics_code": null, "version": ""}</script>

<!--
Using this variable directly instead of using `JSON.parse` is deprecated.
The READTHEDOCS_DATA global variable will be removed in the future.
-->
<script type="text/javascript">
READTHEDOCS_DATA = JSON.parse(document.getElementById('READTHEDOCS_DATA').innerHTML);
</script>

<script type="text/javascript" src="https://assets.readthedocs.org/static/javascript/readthedocs-analytics.js" async="async"></script>

<!-- end RTD <extrahead> -->
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> WarpDrive
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="warp_drive.html">warp_drive package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="example_envs.html">example_envs package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="example_envs.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">example_envs.tag_continuous package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-example_envs.tag_continuous.tag_continuous">example_envs.tag_continuous.tag_continuous module</a></li>
<li class="toctree-l4"><a class="reference internal" href="#module-example_envs.tag_continuous">Module contents</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="example_envs.tag_gridworld.html">example_envs.tag_gridworld package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="example_envs.html#module-example_envs">Module contents</a></li>
</ul>
</li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">WarpDrive</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="modules.html">&lt;no title&gt;</a> &raquo;</li>
        
          <li><a href="example_envs.html">example_envs package</a> &raquo;</li>
        
      <li>example_envs.tag_continuous package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/example_envs.tag_continuous.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="example-envs-tag-continuous-package">
<h1>example_envs.tag_continuous package<a class="headerlink" href="#example-envs-tag-continuous-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-example_envs.tag_continuous.tag_continuous">
<span id="example-envs-tag-continuous-tag-continuous-module"></span><h2>example_envs.tag_continuous.tag_continuous module<a class="headerlink" href="#module-example_envs.tag_continuous.tag_continuous" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">example_envs.tag_continuous.tag_continuous.</span></span><span class="sig-name descname"><span class="pre">TagContinuous</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num_taggers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_runners</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">grid_length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">episode_length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">starting_location_x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">starting_location_y</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">starting_directions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_speed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skill_level_runner</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skill_level_tagger</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_acceleration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_acceleration</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_turn</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.5707963267948966</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_turn</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1.5707963267948966</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_acceleration_levels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_turn_levels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">edge_hit_penalty</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_full_observation</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_other_agents_observed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tagging_distance</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.01</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag_reward_for_tagger</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">step_penalty_for_tagger</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag_penalty_for_runner</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">step_reward_for_runner</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end_of_game_reward_for_runner</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">runner_exits_game_after_tagged</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_cuda</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The game of tag on a continuous circular 2D space.
There are some taggers trying to tag several runners.
The taggers want to get as close as possible to the runner, while the runner
wants to get as far away from them as possible.
Once a runner is tagged, he exits the game if runner_exits_game_after_tagged is True
otherwise he continues to run around (and the tagger can catch him again)</p>
<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.K_nearest_neighbors">
<span class="sig-name descname"><span class="pre">K_nearest_neighbors</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">agent_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">K</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.K_nearest_neighbors" title="Permalink to this definition">¶</a></dt>
<dd><p>Note: ‘K_nearest_neighbors’ is only used when running on CPU step() only.
When using the CUDA step function, this Python method (K_nearest_neighbors)
is also part of the step() function!</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.compute_distance">
<span class="sig-name descname"><span class="pre">compute_distance</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">agent1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">agent2</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.compute_distance" title="Permalink to this definition">¶</a></dt>
<dd><p>Note: ‘compute_distance’ is only used when running on CPU step() only.
When using the CUDA step function, this Python method (compute_distance)
is also part of the step() function!</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.compute_reward">
<span class="sig-name descname"><span class="pre">compute_reward</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.compute_reward" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute and return the rewards for each agent.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.generate_observation">
<span class="sig-name descname"><span class="pre">generate_observation</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.generate_observation" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate and return the observations for every agent.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.get_data_dictionary">
<span class="sig-name descname"><span class="pre">get_data_dictionary</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.get_data_dictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a dictionary of data to push to the device</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.get_tensor_dictionary">
<span class="sig-name descname"><span class="pre">get_tensor_dictionary</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.get_tensor_dictionary" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"> <span class="pre">=</span> <span class="pre">'TagContinuous'</span></em><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Env reset().</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.seed">
<span class="sig-name descname"><span class="pre">seed</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.seed" title="Permalink to this definition">¶</a></dt>
<dd><p>Seeding the environment with a desired seed
Note: this uses the code in
<a class="reference external" href="https://github.com/openai/gym/blob/master/gym/utils/seeding.py">https://github.com/openai/gym/blob/master/gym/utils/seeding.py</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.set_global_state">
<span class="sig-name descname"><span class="pre">set_global_state</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.set_global_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the global state for a specified key, value and timestep.
Note: for a new key, initialize global state to all zeros.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.step">
<span class="sig-name descname"><span class="pre">step</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">actions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.step" title="Permalink to this definition">¶</a></dt>
<dd><p>Env step() - The GPU version calls the corresponding CUDA kernels</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="example_envs.tag_continuous.tag_continuous.TagContinuous.update_state">
<span class="sig-name descname"><span class="pre">update_state</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">delta_accelerations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">delta_turns</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#example_envs.tag_continuous.tag_continuous.TagContinuous.update_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Note: ‘update_state’ is only used when running on CPU step() only.
When using the CUDA step function, this Python method (update_state)
is part of the step() function!</p>
<p>The logic below mirrors (part of) the step function in CUDA.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-example_envs.tag_continuous">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-example_envs.tag_continuous" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="example_envs.tag_gridworld.html" class="btn btn-neutral float-right" title="example_envs.tag_gridworld package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="example_envs.html" class="btn btn-neutral float-left" title="example_envs package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2021, Tian Lan, Sunil Srinivasa, Stephan Zheng.

    </p>
  </div>
    
    
    
    Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>